package redtankface;

import robocode.Robot;
import robocode.ScannedRobotEvent;
import robocode.util.Utils;

/**
 * TankCoordinates
 */
public class TankCoordinates {
	double mX;
	double mY;

	public void setData(ScannedRobotEvent aEvent, Robot aRobot) {
		setData(aEvent.getBearingRadians(), aEvent.getDistance(), aRobot);		
	}

	public void setData(double aBearingRad, double aDistance, Robot aRobot) {
		if (aBearingRad < 0)
			aBearingRad += 2*Math.PI;
		setData(Math.toRadians(aRobot.getHeading()) + aBearingRad, aDistance, aRobot.getX(), aRobot.getY());
	}

	public void setData(double aAngleRad, double aDistance, double aX, double aY) {
		setData(aX + aDistance * Math.sin(aAngleRad), aY + aDistance * Math.cos(aAngleRad));
	}

	public void setData(double aX, double aY) {
		mX = aX;
		mY = aY;
	}
}
